#pragma once

#define SwipeMoveMult 0.7f

class SwipeObject
{
public:
	SwipeObject(int a_TouchID);
	~SwipeObject();
	/*
		Updates according to the position and state of the pointer.
	*/
	void Update( float deltaMs );
	/*
		Gets the movement since last frame.
	*/
	CIwSVec2 GetSwipeMovement();

	bool GetSwiping();
private:
	CIwSVec2 m_LastPosition, m_Position, m_StartPosition;
	int m_TouchID;
	// Is true if we were swiping last frame.
	bool m_Swiping;
	// Is true for 1 frame after the tap.
	bool m_Tapped;

	// The margin of movement for tap registration
	static const int m_TapMarginSq = 9;
};




//#include "Iw2D.h"
//#include <list>
///*
//	The SwipeObject class has to be updated each frame in order to be able to detect swipes. One instance of the class can detect one swiping motion.
//	The integer value passed to the class' constructor determines which input is used to detect swipes when multi-touch is enabled and available.
//*/
//class SwipeObject
//{
//public:
//	SwipeObject( int a_TouchID = 0 );
//	~SwipeObject();
//
//	/*
//		Updates according to the position and state of the pointer.
//	*/
//	void Update( float deltaMs );
//
//	/*
//		Renders the line to the screen.
//	*/
//	void Render();
//
//	/*
//		Calculates and returns the average vector of all the points of the current swipe.
//		Can be used to determine the general direction of a swiping motion.
//		The vector that is returned is NOT normalized, and therefore can be used to measure the 
//		strength or force of the swipe.
//	*/
//	CIwSVec2 GetAverageVector();
//
//	/*
//		Resets the swipe.
//	*/
//	void Reset();
//private:
//	//void AddPoint( CIwSVec2 a_Vec );
//
//	//int m_TouchID;
//	//bool m_IsSwiping;
//	//int m_MaxPoints;
//	//float m_PointIntervalTimer;
//	//float m_PointTimeInterval;
//	//float m_PointTTLTimer;
//	//float m_PointTTL;
//
//	std::list<CIwSVec2> m_Points;
//	CIwSVec2 m_LastPosition;
//};